<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>审题理解类模板 - 逻辑树倒推系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1000px;
            margin: 0 auto;
        }

        .header {
            text-align: center;
            margin-bottom: 30px;
            color: white;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header p {
            font-size: 1.1rem;
            opacity: 0.9;
        }

        .template-content {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.1);
            min-height: 600px;
        }

        .template-header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid #f1f3f4;
        }

        .template-header h3 {
            color: #333;
            font-size: 1.8rem;
            margin-bottom: 10px;
        }

        .template-header .error-type {
            background: #ffe6e6;
            color: #d63031;
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 0.9rem;
            display: inline-block;
        }

        .question-section {
            background: #f8f9fa;
            padding: 25px;
            border-radius: 12px;
            margin-bottom: 30px;
            border-left: 4px solid #667eea;
        }

        .question-title {
            font-size: 1.3rem;
            color: #333;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .question-text {
            font-size: 1.1rem;
            line-height: 1.8;
            color: #495057;
            margin-bottom: 20px;
        }

        .highlight {
            background: #fff3cd;
            padding: 2px 6px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 2px solid transparent;
            display: inline-block;
            margin: 1px;
        }

        .highlight:hover {
            background: #ffeaa7;
            transform: translateY(-1px);
        }

        .highlight.selected {
            background: #00b894;
            color: white;
            border-color: #00a085;
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(0, 184, 148, 0.3);
        }

        .highlight.wrong {
            background: #ff7675;
            color: white;
            animation: shake 0.5s ease-in-out;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-5px); }
            75% { transform: translateX(5px); }
        }

        .keyword-guide {
            background: #e8f4fd;
            padding: 15px;
            border-radius: 8px;
            margin-top: 15px;
            border: 1px solid #b3d9ff;
        }

        .keyword-guide h4 {
            color: #1e3d59;
            margin-bottom: 10px;
        }

        .keyword-types {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .keyword-type {
            background: white;
            padding: 8px 12px;
            border-radius: 15px;
            font-size: 0.9rem;
            border: 1px solid #ccc;
        }

        .reasoning-tree {
            margin-top: 30px;
        }

        .tree-title {
            font-size: 1.4rem;
            color: #333;
            margin-bottom: 20px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .tree-container {
            position: relative;
            padding: 20px;
            background: #fafbfc;
            border-radius: 12px;
            border: 2px solid #e9ecef;
        }

        .tree-level {
            margin-bottom: 40px;
            position: relative;
        }

        .tree-level:last-child {
            margin-bottom: 0;
        }

        .level-title {
            text-align: center;
            font-weight: bold;
            color: #667eea;
            margin-bottom: 15px;
            font-size: 1.1rem;
        }

        .tree-nodes {
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
        }

        .tree-node {
            background: white;
            border: 3px solid #e9ecef;
            border-radius: 12px;
            padding: 15px 20px;
            min-width: 150px;
            text-align: center;
            position: relative;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .tree-node:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 16px rgba(0,0,0,0.15);
        }

        .tree-node.locked {
            opacity: 0.5;
            cursor: not-allowed;
            background: #f8f9fa;
        }

        .tree-node.unlocked {
            border-color: #ffeaa7;
            background: #fffef7;
            cursor: pointer;
        }

        .tree-node.completed {
            background: linear-gradient(135deg, #00b894, #00a085);
            color: white;
            border-color: #00a085;
            transform: scale(1.05);
        }

        .tree-node.completed::after {
            content: "✓";
            position: absolute;
            top: -8px;
            right: -8px;
            background: #00b894;
            color: white;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            font-weight: bold;
        }

        .node-content {
            font-size: 0.95rem;
            line-height: 1.4;
        }

        .node-title {
            font-weight: bold;
            margin-bottom: 5px;
            color: #2d3436;
        }

        .node-description {
            font-size: 0.85rem;
            color: #636e72;
        }

        .tree-connections {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            pointer-events: none;
            z-index: 1;
        }

        .connection-line {
            position: absolute;
            background: #ddd;
            transition: background-color 0.3s ease;
        }

        .connection-line.active {
            background: #00b894;
        }

        .progress-section {
            margin: 30px 0;
            background: white;
            padding: 20px;
            border-radius: 10px;
            border: 2px solid #f1f3f4;
        }

        .progress-title {
            font-size: 1.2rem;
            color: #333;
            margin-bottom: 15px;
            text-align: center;
        }

        .progress-bar {
            width: 100%;
            height: 12px;
            background: #e9ecef;
            border-radius: 6px;
            overflow: hidden;
            margin-bottom: 10px;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 6px;
        }

        .progress-text {
            text-align: center;
            color: #6c757d;
            font-size: 0.9rem;
        }

        .feedback-section {
            margin-top: 20px;
            padding: 20px;
            border-radius: 10px;
            display: none;
            animation: slideIn 0.5s ease;
        }

        .feedback-section.show {
            display: block;
        }

        .feedback-section.success {
            background: #d4edda;
            border: 1px solid #c3e6cb;
            color: #155724;
        }

        .feedback-section.error {
            background: #f8d7da;
            border: 1px solid #f5c6cb;
            color: #721c24;
        }

        .feedback-section.info {
            background: #d1ecf1;
            border: 1px solid #bee5eb;
            color: #0c5460;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .action-buttons {
            text-align: center;
            margin-top: 30px;
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 500;
            margin: 0 10px;
            transition: all 0.3s ease;
            font-size: 1rem;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .btn-primary:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .btn-secondary {
            background: #6c757d;
            color: white;
        }

        .btn-secondary:hover {
            background: #5a6268;
            transform: translateY(-2px);
        }

        .step-indicator {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
            margin: 20px 0;
        }

        .step-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #e9ecef;
            transition: all 0.3s ease;
        }

        .step-dot.active {
            background: #667eea;
            transform: scale(1.3);
        }

        .step-dot.completed {
            background: #00b894;
        }

        @media (max-width: 768px) {
            .header h1 {
                font-size: 2rem;
            }
            
            .tree-nodes {
                flex-direction: column;
                align-items: center;
            }
            
            .tree-node {
                min-width: 200px;
            }
            
            .keyword-types {
                flex-direction: column;
                gap: 10px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🌳 审题理解类模板</h1>
            <p>逻辑树倒推 · 关键词识别 · 步骤引导</p>
        </div>

        <div class="template-content">
            <div class="template-header">
                <h3>🔍 T_COMP_REASON_TREE - 逻辑倒推训练</h3>
                <span class="error-type">keyword_mismatch（关键词识别错误）</span>
            </div>

            <!-- 题目展示与关键词选择 -->
            <div class="question-section">
                <div class="question-title">
                    📋 <span>数学应用题</span>
                </div>
                <div class="question-text">
                    学校食堂购买了<span class="highlight" data-key="quantity1">240个</span><span class="highlight" data-key="object1">苹果</span>和<span class="highlight" data-key="quantity2">180个</span><span class="highlight" data-key="object2">橙子</span>。如果要将这些水果<span class="highlight" data-key="action">平均分配</span>给<span class="highlight" data-key="target">各个班级</span>，每个班级分到的<span class="highlight" data-key="unit">苹果数量</span>比<span class="highlight" data-key="unit2">橙子数量</span>多<span class="highlight" data-key="difference">60个</span>。请问<span class="highlight" data-key="question">学校有多少个班级</span>？
                </div>
                
                <div class="keyword-guide">
                    <h4>🎯 请选择解题的关键信息：</h4>
                    <div class="keyword-types">
                        <div class="keyword-type">🔢 数量信息</div>
                        <div class="keyword-type">🎯 目标对象</div>
                        <div class="keyword-type">🔄 操作行为</div>
                        <div class="keyword-type">❓ 问题核心</div>
                        <div class="keyword-type">📏 单位关系</div>
                    </div>
                </div>
            </div>

            <!-- 进度指示器 -->
            <div class="step-indicator">
                <div class="step-dot active" data-step="1"></div>
                <div class="step-dot" data-step="2"></div>
                <div class="step-dot" data-step="3"></div>
                <div class="step-dot" data-step="4"></div>
            </div>

            <!-- 逻辑推理树 -->
            <div class="reasoning-tree">
                <div class="tree-title">
                    🌳 <span>逻辑推理树 - 从问题倒推线索</span>
                </div>
                
                <div class="tree-container">
                    <!-- 第一层：最终问题 -->
                    <div class="tree-level" data-level="1">
                        <div class="level-title">第一步：明确最终问题</div>
                        <div class="tree-nodes">
                            <div class="tree-node completed" data-node="final-question">
                                <div class="node-content">
                                    <div class="node-title">🎯 最终目标</div>
                                    <div class="node-description">求学校班级数量</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 第二层：需要的线索 -->
                    <div class="tree-level" data-level="2">
                        <div class="level-title">第二步：分析需要什么线索</div>
                        <div class="tree-nodes">
                            <div class="tree-node locked" data-node="clue1">
                                <div class="node-content">
                                    <div class="node-title">📊 分配关系</div>
                                    <div class="node-description">每班苹果比橙子多60个</div>
                                </div>
                            </div>
                            <div class="tree-node locked" data-node="clue2">
                                <div class="node-content">
                                    <div class="node-title">🍎 苹果总数</div>
                                    <div class="node-description">240个苹果</div>
                                </div>
                            </div>
                            <div class="tree-node locked" data-node="clue3">
                                <div class="node-content">
                                    <div class="node-title">🍊 橙子总数</div>
                                    <div class="node-description">180个橙子</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 第三层：现象观察 -->
                    <div class="tree-level" data-level="3">
                        <div class="level-title">第三步：观察已知现象</div>
                        <div class="tree-nodes">
                            <div class="tree-node locked" data-node="phenomenon1">
                                <div class="node-content">
                                    <div class="node-title">⚖️ 平均分配</div>
                                    <div class="node-description">水果要平均分给各班</div>
                                </div>
                            </div>
                            <div class="tree-node locked" data-node="phenomenon2">
                                <div class="node-content">
                                    <div class="node-title">📈 数量差异</div>
                                    <div class="node-description">苹果数量 > 橙子数量</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 第四层：计算表达式 -->
                    <div class="tree-level" data-level="4">
                        <div class="level-title">第四步：建立计算表达式</div>
                        <div class="tree-nodes">
                            <div class="tree-node locked" data-node="expression">
                                <div class="node-content">
                                    <div class="node-title">🧮 数学表达式</div>
                                    <div class="node-description">240/x - 180/x = 60</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 进度展示 -->
            <div class="progress-section">
                <div class="progress-title">🎯 解题进度</div>
                <div class="progress-bar">
                    <div class="progress-fill" style="width: 25%"></div>
                </div>
                <div class="progress-text">已完成：关键词识别 (1/4)</div>
            </div>

            <!-- 反馈区域 -->
            <div class="feedback-section info show">
                <h4>🤖 AI 引导提示</h4>
                <p>首先点击题目中的关键词，选出解题需要的重要信息。选对了才会变绿哦！然后我们一起从最终问题开始，一步步倒推需要哪些线索。</p>
            </div>

            <!-- 操作按钮 -->
            <div class="action-buttons">
                <button class="btn btn-primary" id="next-step-btn" disabled onclick="nextStep()">下一步</button>
                <button class="btn btn-secondary" onclick="resetAll()">重新开始</button>
            </div>
        </div>
    </div>

    <script>
        // 游戏状态管理
        const gameState = {
            currentStep: 1,
            selectedKeywords: [],
            correctKeywords: ['quantity1', 'quantity2', 'difference', 'question', 'action'],
            unlockedNodes: ['final-question'],
            completedNodes: ['final-question'],
            totalSteps: 4
        };

        // 节点解锁顺序
        const nodeProgression = {
            2: ['clue1', 'clue2', 'clue3'],
            3: ['phenomenon1', 'phenomenon2'],
            4: ['expression']
        };

        // 初始化游戏
        document.addEventListener('DOMContentLoaded', function() {
            initializeKeywordSelection();
            updateProgressDisplay();
        });

        // 关键词选择功能
        function initializeKeywordSelection() {
            const highlights = document.querySelectorAll('.highlight');
            
            highlights.forEach(highlight => {
                highlight.addEventListener('click', function() {
                    const key = this.getAttribute('data-key');
                    handleKeywordClick(key, this);
                });
            });
        }

        function handleKeywordClick(key, element) {
            if (gameState.selectedKeywords.includes(key)) {
                return; // 已选择的不重复处理
            }

            if (gameState.correctKeywords.includes(key)) {
                // 正确选择
                element.classList.add('selected');
                gameState.selectedKeywords.push(key);
                
                showFeedback('success', `✓ 很好！"${element.textContent}"是解题的关键信息`);
                
                // 检查是否完成关键词选择
                if (gameState.selectedKeywords.length >= gameState.correctKeywords.length) {
                    setTimeout(() => {
                        completeKeywordSelection();
                    }, 1000);
                }
            } else {
                // 错误选择
                element.classList.add('wrong');
                
                showFeedback('error', `这个信息不是解题的关键，请重新选择`);
                
                // 0.5秒后移除错误样式
                setTimeout(() => {
                    element.classList.remove('wrong');
                }, 500);
            }
        }

        function completeKeywordSelection() {
            showFeedback('success', '🎉 关键词识别完成！现在让我们开始逻辑推理');
            document.getElementById('next-step-btn').disabled = false;
            gameState.currentStep = 2;
            updateStepIndicator();
            updateProgressDisplay();
        }

        // 下一步功能
        function nextStep() {
            if (gameState.currentStep > gameState.totalSteps) {
                return;
            }

            switch(gameState.currentStep) {
                case 2:
                    unlockTreeLevel(2);
                    break;
                case 3:
                    unlockTreeLevel(3);
                    break;
                case 4:
                    unlockTreeLevel(4);
                    showFeedback('success', '🎊 恭喜完成逻辑推理树！你已经掌握了倒推思维方法');
                    break;
            }
            
            gameState.currentStep++;
            updateStepIndicator();
            updateProgressDisplay();
            
            if (gameState.currentStep <= gameState.totalSteps) {
                document.getElementById('next-step-btn').disabled = true;
            }
        }

        // 解锁树状结构层级
        function unlockTreeLevel(level) {
            const nodes = nodeProgression[level];
            
            nodes.forEach((nodeId, index) => {
                setTimeout(() => {
                    const nodeElement = document.querySelector(`[data-node="${nodeId}"]`);
                    nodeElement.classList.remove('locked');
                    nodeElement.classList.add('unlocked');
                    
                    // 添加点击事件
                    nodeElement.addEventListener('click', function() {
                        if (!this.classList.contains('completed')) {
                            this.classList.remove('unlocked');
                            this.classList.add('completed');
                            gameState.completedNodes.push(nodeId);
                            
                            // 检查是否完成当前层级
                            if (gameState.completedNodes.filter(id => nodes.includes(id)).length === nodes.length) {
                                setTimeout(() => {
                                    document.getElementById('next-step-btn').disabled = false;
                                    showFeedback('info', `第${level}步完成！点击"下一步"继续`);
                                }, 500);
                            }
                        }
                    });
                }, index * 300);
            });
            
            showFeedback('info', `第${level}步已解锁！点击节点来完成这一层的推理`);
        }

        // 更新步骤指示器
        function updateStepIndicator() {
            const dots = document.querySelectorAll('.step-dot');
            
            dots.forEach((dot, index) => {
                const step = index + 1;
                dot.classList.remove('active', 'completed');
                
                if (step < gameState.currentStep) {
                    dot.classList.add('completed');
                } else if (step === gameState.currentStep) {
                    dot.classList.add('active');
                }
            });
        }

        // 更新进度显示
        function updateProgressDisplay() {
            const progress = ((gameState.currentStep - 1) / gameState.totalSteps) * 100;
            const progressFill = document.querySelector('.progress-fill');
            const progressText = document.querySelector('.progress-text');
            
            progressFill.style.width = `${progress}%`;
            
            const stepNames = ['关键词识别', '线索分析', '现象观察', '表达式建立'];
            const currentStepName = stepNames[Math.min(gameState.currentStep - 1, stepNames.length - 1)];
            progressText.textContent = `已完成：${currentStepName} (${gameState.currentStep - 1}/${gameState.totalSteps})`;
        }

        // 显示反馈信息
        function showFeedback(type, message) {
            const feedbackSection = document.querySelector('.feedback-section');
            
            feedbackSection.className = `feedback-section show ${type}`;
            feedbackSection.innerHTML = `
                <h4>🤖 AI 反馈</h4>
                <p>${message}</p>
            `;
        }

        // 重置所有状态
        function resetAll() {
            // 重置游戏状态
            gameState.currentStep = 1;
            gameState.selectedKeywords = [];
            gameState.unlockedNodes = ['final-question'];
            gameState.completedNodes = ['final-question'];
            
            // 重置关键词高亮
            document.querySelectorAll('.highlight').forEach(el => {
                el.classList.remove('selected', 'wrong');
            });
            
            // 重置树节点
            document.querySelectorAll('.tree-node').forEach(node => {
                const nodeId = node.getAttribute('data-node');
                if (nodeId !== 'final-question') {
                    node.classList.remove('unlocked', 'completed');
                    node.classList.add('locked');
                    node.replaceWith(node.cloneNode(true)); // 移除事件监听器
                }
            });
            
            // 重置按钮状态
            document.getElementById('next-step-btn').disabled = true;
            
            // 重置步骤指示器和进度
            updateStepIndicator();
            updateProgressDisplay();
            
            // 显示初始提示
            showFeedback('info', '重新开始！首先点击题目中的关键词，选出解题需要的重要信息。');
        }
    </script>
</body>
</html>